<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GTlsConnection</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GIO 参考手册">
<link rel="up" href="tls.html" title="TLS (SSL) support">
<link rel="prev" href="gio-GTlsCertificate.html" title="GTlsCertificate">
<link rel="next" href="gio-GTlsClientConnection.html" title="GTlsClientConnection">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gio-GTlsCertificate.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="tls.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GIO 参考手册</th>
<td><a accesskey="n" href="gio-GTlsClientConnection.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gio-GTlsConnection.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gio-GTlsConnection.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gio-GTlsConnection"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gio-GTlsConnection.top_of_page"></a>GTlsConnection</span></h2>
<p>GTlsConnection — TLS connection type</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gio-GTlsConnection.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gio/gio.h&gt;

                    <a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection">GTlsConnection</a>;
<span class="returnvalue">void</span>                <a class="link" href="gio-GTlsConnection.html#g-tls-connection-set-certificate" title="g_tls_connection_set_certificate ()">g_tls_connection_set_certificate</a>    (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-GTlsCertificate.html#GTlsCertificate" title="GTlsCertificate"><span class="type">GTlsCertificate</span></a> *certificate</code></em>);
<a class="link" href="gio-GTlsCertificate.html#GTlsCertificate" title="GTlsCertificate"><span class="returnvalue">GTlsCertificate</span></a> *   <a class="link" href="gio-GTlsConnection.html#g-tls-connection-get-certificate" title="g_tls_connection_get_certificate ()">g_tls_connection_get_certificate</a>    (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);
<a class="link" href="gio-GTlsCertificate.html#GTlsCertificate" title="GTlsCertificate"><span class="returnvalue">GTlsCertificate</span></a> *   <a class="link" href="gio-GTlsConnection.html#g-tls-connection-get-peer-certificate" title="g_tls_connection_get_peer_certificate ()">g_tls_connection_get_peer_certificate</a>
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);
<a class="link" href="gio-TLS-Overview.html#GTlsCertificateFlags" title="enum GTlsCertificateFlags"><span class="returnvalue">GTlsCertificateFlags</span></a>  <a class="link" href="gio-GTlsConnection.html#g-tls-connection-get-peer-certificate-errors" title="g_tls_connection_get_peer_certificate_errors ()">g_tls_connection_get_peer_certificate_errors</a>
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gio-GTlsConnection.html#g-tls-connection-set-require-close-notify" title="g_tls_connection_set_require_close_notify ()">g_tls_connection_set_require_close_notify</a>
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> require_close_notify</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gio-GTlsConnection.html#g-tls-connection-get-require-close-notify" title="g_tls_connection_get_require_close_notify ()">g_tls_connection_get_require_close_notify</a>
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);
enum                <a class="link" href="gio-GTlsConnection.html#GTlsRehandshakeMode" title="enum GTlsRehandshakeMode">GTlsRehandshakeMode</a>;
<span class="returnvalue">void</span>                <a class="link" href="gio-GTlsConnection.html#g-tls-connection-set-rehandshake-mode" title="g_tls_connection_set_rehandshake_mode ()">g_tls_connection_set_rehandshake_mode</a>
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsRehandshakeMode" title="enum GTlsRehandshakeMode"><span class="type">GTlsRehandshakeMode</span></a> mode</code></em>);
<a class="link" href="gio-GTlsConnection.html#GTlsRehandshakeMode" title="enum GTlsRehandshakeMode"><span class="returnvalue">GTlsRehandshakeMode</span></a>  <a class="link" href="gio-GTlsConnection.html#g-tls-connection-get-rehandshake-mode" title="g_tls_connection_get_rehandshake_mode ()">g_tls_connection_get_rehandshake_mode</a>
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gio-GTlsConnection.html#g-tls-connection-set-use-system-certdb" title="g_tls_connection_set_use_system_certdb ()">g_tls_connection_set_use_system_certdb</a>
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> use_system_certdb</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gio-GTlsConnection.html#g-tls-connection-get-use-system-certdb" title="g_tls_connection_get_use_system_certdb ()">g_tls_connection_get_use_system_certdb</a>
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);

<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gio-GTlsConnection.html#g-tls-connection-handshake" title="g_tls_connection_handshake ()">g_tls_connection_handshake</a>          (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-GCancellable.html#GCancellable" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gio-GTlsConnection.html#g-tls-connection-handshake-async" title="g_tls_connection_handshake_async ()">g_tls_connection_handshake_async</a>    (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> io_priority</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-GCancellable.html#GCancellable" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gio-GTlsConnection.html#g-tls-connection-handshake-finish" title="g_tls_connection_handshake_finish ()">g_tls_connection_handshake_finish</a>   (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-GAsyncResult.html#GAsyncResult" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);

<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gio-GTlsConnection.html#g-tls-connection-emit-accept-certificate" title="g_tls_connection_emit_accept_certificate ()">g_tls_connection_emit_accept_certificate</a>
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-GTlsCertificate.html#GTlsCertificate" title="GTlsCertificate"><span class="type">GTlsCertificate</span></a> *peer_cert</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-TLS-Overview.html#GTlsCertificateFlags" title="enum GTlsCertificateFlags"><span class="type">GTlsCertificateFlags</span></a> errors</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gio-GTlsConnection.description"></a><h2>Description</h2>
<p>
<a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> is the base TLS connection class type, which wraps
a <a class="link" href="gio-GIOStream.html#GIOStream" title="GIOStream"><span class="type">GIOStream</span></a> and provides TLS encryption on top of it. Its
subclasses, <a class="link" href="gio-GTlsClientConnection.html#GTlsClientConnection" title="GTlsClientConnection"><span class="type">GTlsClientConnection</span></a> and <a class="link" href="gio-GTlsServerConnection.html#GTlsServerConnection" title="GTlsServerConnection"><span class="type">GTlsServerConnection</span></a>,
implement client-side and server-side TLS, respectively.
</p>
</div>
<div class="refsect1">
<a name="gio-GTlsConnection.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GTlsConnection"></a><h3>GTlsConnection</h3>
<pre class="programlisting">typedef struct {
  GIOStream parent_instance;

  GTlsConnectionPrivate *priv;
} GTlsConnection;
</pre>
<p>
TLS connection. This is an abstract type that will be subclassed by
a TLS-library-specific subtype.
</p>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-tls-connection-set-certificate"></a><h3>g_tls_connection_set_certificate ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_tls_connection_set_certificate    (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-GTlsCertificate.html#GTlsCertificate" title="GTlsCertificate"><span class="type">GTlsCertificate</span></a> *certificate</code></em>);</pre>
<p>
This sets the certificate that <em class="parameter"><code>conn</code></em> will present to its peer
during the TLS handshake. For a <a class="link" href="gio-GTlsServerConnection.html#GTlsServerConnection" title="GTlsServerConnection"><span class="type">GTlsServerConnection</span></a>, it is
mandatory to set this, and that will normally be done at construct
time.
</p>
<p>
For a <a class="link" href="gio-GTlsClientConnection.html#GTlsClientConnection" title="GTlsClientConnection"><span class="type">GTlsClientConnection</span></a>, this is optional. If a handshake fails
with <a class="link" href="gio-TLS-Overview.html#G-TLS-ERROR-CERTIFICATE-REQUIRED:CAPS"><code class="literal">G_TLS_ERROR_CERTIFICATE_REQUIRED</code></a>, that means that the server
requires a certificate, and if you try connecting again, you should
call this method first. You can call
<a class="link" href="gio-GTlsClientConnection.html#g-tls-client-connection-get-accepted-cas" title="g_tls_client_connection_get_accepted_cas ()"><code class="function">g_tls_client_connection_get_accepted_cas()</code></a> on the failed connection
to get a list of Certificate Authorities that the server will
accept certificates from.
</p>
<p>
(It is also possible that a server will allow the connection with
or without a certificate; in that case, if you don't provide a
certificate, you can tell that the server requested one by the fact
that <a class="link" href="gio-GTlsClientConnection.html#g-tls-client-connection-get-accepted-cas" title="g_tls_client_connection_get_accepted_cas ()"><code class="function">g_tls_client_connection_get_accepted_cas()</code></a> will return
non-<a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.)
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>certificate</code></em> :</span></p></td>
<td>the certificate to use for <em class="parameter"><code>conn</code></em>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-tls-connection-get-certificate"></a><h3>g_tls_connection_get_certificate ()</h3>
<pre class="programlisting"><a class="link" href="gio-GTlsCertificate.html#GTlsCertificate" title="GTlsCertificate"><span class="returnvalue">GTlsCertificate</span></a> *   g_tls_connection_get_certificate    (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);</pre>
<p>
Gets <em class="parameter"><code>conn</code></em>'s certificate, as set by
<a class="link" href="gio-GTlsConnection.html#g-tls-connection-set-certificate" title="g_tls_connection_set_certificate ()"><code class="function">g_tls_connection_set_certificate()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<em class="parameter"><code>conn</code></em>'s certificate, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-tls-connection-get-peer-certificate"></a><h3>g_tls_connection_get_peer_certificate ()</h3>
<pre class="programlisting"><a class="link" href="gio-GTlsCertificate.html#GTlsCertificate" title="GTlsCertificate"><span class="returnvalue">GTlsCertificate</span></a> *   g_tls_connection_get_peer_certificate
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);</pre>
<p>
Gets <em class="parameter"><code>conn</code></em>'s peer's certificate after the handshake has completed.
(It is not set during the emission of
<span class="type">"accept-certificate"</span>.)
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<em class="parameter"><code>conn</code></em>'s peer's certificate, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-tls-connection-get-peer-certificate-errors"></a><h3>g_tls_connection_get_peer_certificate_errors ()</h3>
<pre class="programlisting"><a class="link" href="gio-TLS-Overview.html#GTlsCertificateFlags" title="enum GTlsCertificateFlags"><span class="returnvalue">GTlsCertificateFlags</span></a>  g_tls_connection_get_peer_certificate_errors
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);</pre>
<p>
Gets the errors associated with validating <em class="parameter"><code>conn</code></em>'s peer's
certificate, after the handshake has completed. (It is not set
during the emission of <span class="type">"accept-certificate"</span>.)
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<em class="parameter"><code>conn</code></em>'s peer's certificate errors</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-tls-connection-set-require-close-notify"></a><h3>g_tls_connection_set_require_close_notify ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_tls_connection_set_require_close_notify
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> require_close_notify</code></em>);</pre>
<p>
Sets whether or not <em class="parameter"><code>conn</code></em> expects a proper TLS close notification
before the connection is closed. If this is <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> (the default),
then <em class="parameter"><code>conn</code></em> will expect to receive a TLS close notification from its
peer before the connection is closed, and will return a
<a class="link" href="gio-TLS-Overview.html#G-TLS-ERROR-EOF:CAPS"><code class="literal">G_TLS_ERROR_EOF</code></a> error if the connection is closed without proper
notification (since this may indicate a network error, or
man-in-the-middle attack).
</p>
<p>
In some protocols, the application will know whether or not the
connection was closed cleanly based on application-level data
(because the application-level data includes a length field, or is
somehow self-delimiting); in this case, the close notify is
redundant and sometimes omitted. (TLS 1.1 explicitly allows this;
in TLS 1.0 it is technically an error, but often done anyway.) You
can use <a class="link" href="gio-GTlsConnection.html#g-tls-connection-set-require-close-notify" title="g_tls_connection_set_require_close_notify ()"><code class="function">g_tls_connection_set_require_close_notify()</code></a> to tell <em class="parameter"><code>conn</code></em>
to allow an "unannounced" connection close, in which case the close
will show up as a 0-length read, as in a non-TLS
<a class="link" href="gio-GSocketConnection.html#GSocketConnection" title="GSocketConnection"><span class="type">GSocketConnection</span></a>, and it is up to the application to check that
the data has been fully received.
</p>
<p>
Note that this only affects the behavior when the peer closes the
connection; when the application calls <a class="link" href="gio-GIOStream.html#g-io-stream-close" title="g_io_stream_close ()"><code class="function">g_io_stream_close()</code></a> itself
on <em class="parameter"><code>conn</code></em>, this will send a close notification regardless of the
setting of this property. If you explicitly want to do an unclean
close, you can close <em class="parameter"><code>conn</code></em>'s <span class="type">"base-io-stream"</span> rather
than closing <em class="parameter"><code>conn</code></em> itself.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>require_close_notify</code></em> :</span></p></td>
<td>whether or not to require close notification</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-tls-connection-get-require-close-notify"></a><h3>g_tls_connection_get_require_close_notify ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_tls_connection_get_require_close_notify
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);</pre>
<p>
Tests whether or not <em class="parameter"><code>conn</code></em> expects a proper TLS close notification
when the connection is closed. See
<a class="link" href="gio-GTlsConnection.html#g-tls-connection-set-require-close-notify" title="g_tls_connection_set_require_close_notify ()"><code class="function">g_tls_connection_set_require_close_notify()</code></a> for details.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>conn</code></em> requires a proper TLS close
notification.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="GTlsRehandshakeMode"></a><h3>enum GTlsRehandshakeMode</h3>
<pre class="programlisting">typedef enum {
  G_TLS_REHANDSHAKE_NEVER,
  G_TLS_REHANDSHAKE_SAFELY,
  G_TLS_REHANDSHAKE_UNSAFELY
} GTlsRehandshakeMode;
</pre>
<p>
When to allow rehandshaking. See
<a class="link" href="gio-GTlsConnection.html#g-tls-connection-set-rehandshake-mode" title="g_tls_connection_set_rehandshake_mode ()"><code class="function">g_tls_connection_set_rehandshake_mode()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="G-TLS-REHANDSHAKE-NEVER:CAPS"></a><span class="term"><code class="literal">G_TLS_REHANDSHAKE_NEVER</code></span></p></td>
<td>Never allow rehandshaking
</td>
</tr>
<tr>
<td><p><a name="G-TLS-REHANDSHAKE-SAFELY:CAPS"></a><span class="term"><code class="literal">G_TLS_REHANDSHAKE_SAFELY</code></span></p></td>
<td>Allow safe rehandshaking only
</td>
</tr>
<tr>
<td><p><a name="G-TLS-REHANDSHAKE-UNSAFELY:CAPS"></a><span class="term"><code class="literal">G_TLS_REHANDSHAKE_UNSAFELY</code></span></p></td>
<td>Allow unsafe rehandshaking
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-tls-connection-set-rehandshake-mode"></a><h3>g_tls_connection_set_rehandshake_mode ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_tls_connection_set_rehandshake_mode
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsRehandshakeMode" title="enum GTlsRehandshakeMode"><span class="type">GTlsRehandshakeMode</span></a> mode</code></em>);</pre>
<p>
Sets how <em class="parameter"><code>conn</code></em> behaves with respect to rehandshaking requests.
</p>
<p>
<a class="link" href="gio-GTlsConnection.html#G-TLS-REHANDSHAKE-NEVER:CAPS"><code class="literal">G_TLS_REHANDSHAKE_NEVER</code></a> means that it will never agree to
rehandshake after the initial handshake is complete. (For a client,
this means it will refuse rehandshake requests from the server, and
for a server, this means it will close the connection with an error
if the client attempts to rehandshake.)
</p>
<p>
<a class="link" href="gio-GTlsConnection.html#G-TLS-REHANDSHAKE-SAFELY:CAPS"><code class="literal">G_TLS_REHANDSHAKE_SAFELY</code></a> means that the connection will allow a
rehandshake only if the other end of the connection supports the
TLS <code class="literal">renegotiation_info</code> extension. This is the
default behavior, but means that rehandshaking will not work
against older implementations that do not support that extension.
</p>
<p>
<a class="link" href="gio-GTlsConnection.html#G-TLS-REHANDSHAKE-UNSAFELY:CAPS"><code class="literal">G_TLS_REHANDSHAKE_UNSAFELY</code></a> means that the connection will allow
rehandshaking even without the
<code class="literal">renegotiation_info</code> extension. On the server side
in particular, this is not recommended, since it leaves the server
open to certain attacks. However, this mode is necessary if you
need to allow renegotiation with older client software.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
<td>the rehandshaking mode</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-tls-connection-get-rehandshake-mode"></a><h3>g_tls_connection_get_rehandshake_mode ()</h3>
<pre class="programlisting"><a class="link" href="gio-GTlsConnection.html#GTlsRehandshakeMode" title="enum GTlsRehandshakeMode"><span class="returnvalue">GTlsRehandshakeMode</span></a>  g_tls_connection_get_rehandshake_mode
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);</pre>
<p>
Gets <em class="parameter"><code>conn</code></em> rehandshaking mode. See
<code class="function">g_tls_connection_set_rehandshake()</code> for details.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<em class="parameter"><code>conn</code></em>'s rehandshaking mode</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-tls-connection-set-use-system-certdb"></a><h3>g_tls_connection_set_use_system_certdb ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_tls_connection_set_use_system_certdb
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> use_system_certdb</code></em>);</pre>
<p>
Sets whether <em class="parameter"><code>conn</code></em> uses the system certificate database to verify
peer certificates. This is <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> by default. If set to <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, then
peer certificate validation will always set the
<a class="link" href="gio-TLS-Overview.html#G-TLS-CERTIFICATE-UNKNOWN-CA:CAPS"><code class="literal">G_TLS_CERTIFICATE_UNKNOWN_CA</code></a> error (meaning
<span class="type">"accept-certificate"</span> will always be emitted on
client-side connections, unless that bit is not set in
<span class="type">"validation-flags"</span>).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>use_system_certdb</code></em> :</span></p></td>
<td>whether to use the system certificate database</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-tls-connection-get-use-system-certdb"></a><h3>g_tls_connection_get_use_system_certdb ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_tls_connection_get_use_system_certdb
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);</pre>
<p>
Gets whether <em class="parameter"><code>conn</code></em> uses the system certificate database to verify
peer certificates. See <a class="link" href="gio-GTlsConnection.html#g-tls-connection-set-use-system-certdb" title="g_tls_connection_set_use_system_certdb ()"><code class="function">g_tls_connection_set_use_system_certdb()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>whether <em class="parameter"><code>conn</code></em> uses the system certificate database</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-tls-connection-handshake"></a><h3>g_tls_connection_handshake ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_tls_connection_handshake          (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-GCancellable.html#GCancellable" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Attempts a TLS handshake on <em class="parameter"><code>conn</code></em>.
</p>
<p>
On the client side, it is never necessary to call this method;
although the connection needs to perform a handshake after
connecting (or after sending a "STARTTLS"-type command) and may
need to rehandshake later if the server requests it,
<a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> will handle this for you automatically when you try
to send or receive data on the connection. However, you can call
<a class="link" href="gio-GTlsConnection.html#g-tls-connection-handshake" title="g_tls_connection_handshake ()"><code class="function">g_tls_connection_handshake()</code></a> manually if you want to know for sure
whether the initial handshake succeeded or failed (as opposed to
just immediately trying to write to <em class="parameter"><code>conn</code></em>'s output stream, in which
case if it fails, it may not be possible to tell if it failed
before or after completing the handshake).
</p>
<p>
Likewise, on the server side, although a handshake is necessary at
the beginning of the communication, you do not need to call this
function explicitly unless you want clearer error reporting.
However, you may call <a class="link" href="gio-GTlsConnection.html#g-tls-connection-handshake" title="g_tls_connection_handshake ()"><code class="function">g_tls_connection_handshake()</code></a> later on to
renegotiate parameters (encryption methods, etc) with the client.
</p>
<p>
<span class="type">"accept_certificate"</span> may be emitted during the
handshake.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GCancellable.html#GCancellable" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>a <a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>success or failure</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-tls-connection-handshake-async"></a><h3>g_tls_connection_handshake_async ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_tls_connection_handshake_async    (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> io_priority</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-GCancellable.html#GCancellable" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
Asynchronously performs a TLS handshake on <em class="parameter"><code>conn</code></em>. See
<a class="link" href="gio-GTlsConnection.html#g-tls-connection-handshake" title="g_tls_connection_handshake ()"><code class="function">g_tls_connection_handshake()</code></a> for more information.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>io_priority</code></em> :</span></p></td>
<td>the <a class="link" href="gio-GIOScheduler.html#io-priority">I/O priority</a>
of the request.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GCancellable.html#GCancellable" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
<td>callback to call when the handshake is complete</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>the data to pass to the callback function</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-tls-connection-handshake-finish"></a><h3>g_tls_connection_handshake_finish ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_tls_connection_handshake_finish   (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-GAsyncResult.html#GAsyncResult" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Finish an asynchronous TLS handshake operation. See
<a class="link" href="gio-GTlsConnection.html#g-tls-connection-handshake" title="g_tls_connection_handshake ()"><code class="function">g_tls_connection_handshake()</code></a> for more information.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>result</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GAsyncResult.html#GAsyncResult" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>a <a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> pointer, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> on failure, in which
case <em class="parameter"><code>error</code></em> will be set.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-tls-connection-emit-accept-certificate"></a><h3>g_tls_connection_emit_accept_certificate ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_tls_connection_emit_accept_certificate
                                                        (<em class="parameter"><code><a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-GTlsCertificate.html#GTlsCertificate" title="GTlsCertificate"><span class="type">GTlsCertificate</span></a> *peer_cert</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-TLS-Overview.html#GTlsCertificateFlags" title="enum GTlsCertificateFlags"><span class="type">GTlsCertificateFlags</span></a> errors</code></em>);</pre>
<p>
Used by <a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a> implementations to emit the
<span class="type">"accept-certificate"</span> signal.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
<td>a <a class="link" href="gio-GTlsConnection.html#GTlsConnection" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>peer_cert</code></em> :</span></p></td>
<td>the peer's <a class="link" href="gio-GTlsCertificate.html#GTlsCertificate" title="GTlsCertificate"><span class="type">GTlsCertificate</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>errors</code></em> :</span></p></td>
<td>the problems with <em class="parameter"><code>peer_cert</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if one of the signal handlers has returned
<a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> to accept <em class="parameter"><code>peer_cert</code></em>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.17</div>
</body>
</html>